<%@ include file="../common/IncludeTop.jsp"%>

<div id="BackLink">
    <a href="browse?action=viewMain">Return to Main Menu</a>
</div>

<div id="Catalog">
    <div id="Cart">
        <h2>Items browsing history</h2>
            <table>
                <tr>
                    <th><b>Item ID</b></th>
                    <th><b>Description</b></th>
                    <th><b>List Price</b></th>
                    <th><b>Views</b></th>
                    <th><b>Last browse time</b></th>
                </tr>

                <c:if test="${sessionScope.userLog.viewItemLogs.size() == 0}">
                    <tr>
                        <td colspan="8"><b>Your browsing history is empty.</b></td>
                    </tr>
                </c:if>

                <c:forEach var="viewLog" items="${sessionScope.userLog.viewItemLogs}">
                    <tr>
                        <td>
                            <a href="browse?action=viewItem&itemId=${viewLog.itemId}">${viewLog.itemId}</a>
                        </td>
                        <td>
                                ${viewLog.descn}
                        </td>
                        <td>
                                ${viewLog.listPrice}
                        </td>
                        <td>
                                ${viewLog.count}
                        </td>
                        <td>
                            <fmt:formatDate value="${viewLog.date}" pattern="yyyy-MM-dd HH:mm:ss"/>

                        </td>
                    </tr>
                </c:forEach>
            </table>



        <h2>Shopping cart record</h2>
        <table>
            <tr>
                <th><b>Item ID</b></th>
                <th><b>Description</b></th>
                <th><b>List Price</b></th>
                <th><b>Times added to cart</b></th>
                <th><b>Last add time</b></th>
            </tr>

            <c:if test="${sessionScope.userLog.addToCartLogs.size() == 0}">
                <tr>
                    <td colspan="8"><b>Your cart record is empty.</b></td>
                </tr>
            </c:if>

            <c:forEach var="cartLog" items="${sessionScope.userLog.addToCartLogs}">
                <tr>
                    <td>
                        <a href="browse?action=viewItem&itemId=${cartLog.itemId}">${cartLog.itemId}</a>
                    </td>
                    <td>
                            ${cartLog.descn}
                    </td>
                    <td>
                            ${cartLog.listPrice}
                    </td>
                    <td>
                            ${cartLog.count}
                    </td>
                    <td>
                        <fmt:formatDate value="${cartLog.date}" pattern="yyyy-MM-dd HH:mm:ss"/>
                    </td>
                </tr>
            </c:forEach>
        </table>


    </div>
    <div id="Separator">&nbsp;</div>
</div>
<%@ include file="../common/IncludeBottom.jsp"%>
